<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<script type="text/javascript">
	$(function() {
		var $grid = $('#export_grid_user');
		var $title = '用户';
		var $baseUrl = 'sys/user';
		$grid.datagrid({
			title : $title + '列表',
			url : $baseUrl + '/page?sort=sort,asc',
			dialog : {
				url : $baseUrl,
				name : $title,
				search : {
					width : 880,
					height : 468
				}
			},
			pagination : true,
			pageSize : 50,
			pageList : [ 50, 100, 200 ],
			columns : [ [ {
				field : 'username',
				title : '员工号',
				width : 80
			}, {
				field : 'name',
				title : '姓名',
				width : '80',
				formatter:function(value,row){return row.cade==null?'':row.cade.name;}
			}, {
				field : 'dept',
				title : '部门',
				width : 120,
				formatter : function(value, row, index) {
					return row.dept ? row.dept.name : '';
				}
			}, {
				field : 'telphone',
				title : '手机',
				width : 80
			}, {
				field : 'idNo',
				title : '身份证号',
				width : 120,
				formatter:function(value,row){return row.cade==null?'':row.cade.idNo;}
			}, {
				field : 'status',
				title : '人员种类',
				width : 60,
				formatter : function(value, row, index) {
					return row.status ? row.status.name : '';
				}
			}, {
				field : 'sex',
				title : '性别',
				width : 40,
				formatter : function(value, row, index) {
					return row.cade==null?'':row.cade.sex;
				}
			}, {
				field : 'hireDate',
				title : '入职日期',
				width : 120
			}, {
				field : 'leaveDate',
				title : '离职日期',
				width : 120
			}, {
				field : 'qq',
				title : 'QQ',
				width : 60
			}, {
				field : 'email',
				title : '邮件',
				width : 80
			}, {
				field : 'education',
				title : '学历',
				width : 60,
				formatter : function(value, row, index) {
					return row.education ? row.education.name : '';
				}
			}, {
				field : 'major',
				title : '专业',
				width : 100
			}, $.fields.description, $.fields.sort, $.fields.status ] ],
			toolbar : [{
				text:'导出',
				iconCls:'icon-print',
				handler:function(){
					var options=$.crudgrid.getGrid(this).datagrid('options');
					//console.log(options.queryParams);
					$.post('sys/user/exportHrm',options.queryParams,function(data){
						setTimeout(function () {
							window.location = 'sys/user/exportHrm1?fileName='+data; 
						}, 50);
					},'text'); 
				}
			},$.crudgrid.buttons.refresh, $.crudgrid.buttons.search,$.crudgrid.buttons.clearSearch ]
		});
	});
</script>
<table id="export_grid_user"></table>
